import { Injectable, Logger } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { Repository } from 'typeorm';
import { ConfigService } from '@nestjs/config';
import { BaseService } from '@wwjCommon/base/base.service';
import { CacheService } from '@wwjCommon/cache/cache.service';
import { LoggingService } from '@wwjCommon/logging/logging.service';
import { UploadService } from '@wwjVendor/upload/upload.service';
import { PayService } from '@wwjVendor/pay/pay.service';
import { SmsService } from '@wwjVendor/sms/sms.service';
import { NoticeService } from '@wwjVendor/notice/notice.service';

@Injectable()
export class WechatConfigService extends BaseService<any> {
  private readonly logger = new Logger(WechatConfigService.name);

  constructor(
    @InjectRepository(Object)
    protected readonly repository: Repository<any>,
    private readonly cacheService: CacheService,
    private readonly configService: ConfigService,
    private readonly loggingService: LoggingService,
    private readonly uploadService: UploadService,
    private readonly payService: PayService,
    private readonly smsService: SmsService,
    private readonly noticeService: NoticeService,
  ) {
    super(repository);
  }

  /**
   * getWechatConfig
   * 对应 PHP: WechatConfigService_admin::getWechatConfig()
   * 逻辑类型: undefined - undefined
   */
  async getWechatConfig() {
    // 基于PHP真实逻辑: getWechatConfig
    // PHP原文: $config_info = (new CoreWechatConfigService())->getWechatConfig($this->site_id);         foreach ($config_info as $k => $v) {             if ($v !== '...
const config_info = this.coreWechatConfigService.getWechatConfig(this.site_id);
        foreach (config_info as k => v) {
            if (v !== '' && in_[k, ['app_secret', 'encoding_aes_key'))) {
                config_info[k] = CommonDict.ENCRYPT_STR;
            }
  }

  /**
   * setWechatConfig
   * 对应 PHP: WechatConfigService_admin::setWechatConfig()
   * 逻辑类型: undefined - undefined
   */
  async setWechatConfig(data: any[]) {
    // 基于PHP真实逻辑: setWechatConfig
    // PHP原文: $config = (new CoreWechatConfigService())->getWechatConfig($this->site_id);         foreach ($data as $k => $v) {             if ($v == CommonDict::EN...
const config = this.coreWechatConfigService.getWechatConfig(this.site_id);
        foreach (data as k => v) {
            if (v == CommonDict.ENCRYPT_STR) {
                data[k] = config[k];
            }
  }

  /**
   * getWechatStaticInfo
   * 对应 PHP: WechatConfigService_admin::getWechatStaticInfo()
   * 逻辑类型: undefined - undefined
   */
  async getWechatStaticInfo() {
    // 基于PHP真实逻辑: getWechatStaticInfo
    // PHP原文: return (new CoreWechatConfigService())->getWechatStaticInfo($this->site_id);     } }...
return this.coreWechatConfigService.getWechatStaticInfo(this.site_id);
    }
}
  }
}
